<template>
	<view class="container-addpurse">
		<view class="lang-top">
			<view class="backIcon" @click="back()">
				<uni-icons type="left" size="26"></uni-icons>
			</view>
			<view class="langText">
				{{$t('新增钱包')}}
			</view>
			<view class="clearView">
				
			</view>
		</view>
		<view class="fill-input-view">
			<view class="item-view">
				<view class="ari_font">{{$t('银行名称')}}：</view>
				<input v-model="form.bankName" type="text" :placeholder="$t('请输入银行名称')" class="card">
			</view>
			<view class="item-view">
				<view class="ari_font">{{$t('姓名')}}：</view>
				<input v-model="form.name" type="text" :placeholder="$t('请输入持卡人姓名')" class="card">
			</view>
			<view class="item-view">
				<view class="ari_font">{{$t('卡号')}}：</view>
				<input v-model="form.cardNum" type="text" :placeholder="$t('请输入卡号')" class="card">
			</view>
			<view class="item-view">
				<view class="ari_font">{{$t('支行')}}：</view>
				<input v-model="form.subbranch" type="text" :placeholder="$t('请输入支行')" class="card">
			</view>
			<view class="item-view">
				<view class="ari_font">{{$t('电话')}}：</view>
				<input v-model="form.phone" type="text" :placeholder="$t('请输入电话')" class="card">
			</view>
			<view class="item-view">
				<view class="ari_font">IFSC：</view>
				<input v-model="form.ifsc" type="text" placeholder="IFSC" class="card">
			</view>
		</view>
		<view class="basic_btn" @click="addbank">
			保存
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				form:{
					bankName:'',
					name:'',
					cardNum:'',
					subbranch:'',
					phone:'',
					ifsc:''
				}
			}
		},
		methods:{
			addbank(){
				let data = {
					name:this.form.name,
					bank_name:this.form.bankName,
					cradnum:this.form.cardNum,
					bank_branch:this.form.subbranch,
					phone:this.form.phone,
					ifsc:this.form.ifsc,
				}
				this.$http.post(
					'api/MemberBank/create',//接口名
					data,//参数合集
				).then(res=>{
					uni.showToast({
						icon: 'success',
						title: res.msg
					});
					setTimeout(function(){
						uni.navigateTo({
							url:"/pages/my/purseManagement"
						})
					},1500)
				},(err)=>{//失败的操作
					uni.showToast({
						icon: 'error',
						title: err.data.message
					});
				})
			},
			back(){
				uni.navigateBack({
					delta:1,//返回层数，2则上上页
				})
			},
			// 保存
			submitAdd(){
				
			}
		}
	}
</script>

<style scoped>
	.container-addpurse{
		background-color: #f6f6f6;
	}
	.lang-top{
		display: flex;
		padding-left:10rpx;
		height:88rpx;
		line-height:88rpx;
		background-color: #fff;
	}
	.backIcon{
		width:20%;
	}
	.langText{
		font-size:36rpx;
		width:60%;
		text-align: center;
		
	}
	.clearView{
		width:20%;
	}
	.item-view{
		height: 50px;
		padding: 0 16px;
		font-size: 14px;
		display: flex;
		justify-content: flex-start;
		align-items: center;
		border-bottom: 1px solid #ececec;
	}
	.ari_font{
		word-break: keep-all;
		    white-space: nowrap;
		    height: 20px;
		    font-size: 14px;
		    font-weight: 600;
		    color: rgba(0, 0, 0, .8);
		    line-height: 20px;
		    margin-right: 5px;
	}
	.card{
		line-height:28rpx;
		font-size:28rpx;
	}
	.fill-input-view{
		background-color: #fff;
		margin-top:24rpx;
	}
	.basic_btn {
		margin: 106rpx auto 0 auto;
		background: linear-gradient(90deg, #e4392e, #ff4d16);
	    height: 90rpx;
	    line-height: 90rpx;
	    font-size: 32rpx;
	    width: 90%;
	    border-radius: 46rpx;
	    color: #fff;
	    text-align: center;
	}
</style>